package com.wanbatv.wanba.jianshencao.activity;

import android.view.KeyEvent;

/**
 * Created by ricardo on 2016/7/19.
 */
public class CombinationKey {
    private String[] mkeys;//组合键
    private int length=0;
    private int i=0;
    public CombinationKey(String[] keys){
        mkeys=keys;
        length =mkeys.length;
    }
    public boolean isMatch(int keycode){
        boolean isMatch=false;
        String keyCodeToString = KeyEvent.keyCodeToString(keycode);
        String keyCodeString = mkeys[i];
        if(keyCodeToString.equals(keyCodeString)){
            i++;
            if (length==i){
                isMatch=true;
                i=0;
            }else{
                isMatch=false;
            }
        }else {
            i=0;
        }
        return isMatch;
    }
}
